package com.yswwpp.cross;

import java.nio.charset.CharacterCodingException;

import org.apache.mina.core.buffer.IoBuffer;

public abstract class Decoder extends Coder
{
    public String getString(IoBuffer buffer) throws CharacterCodingException
    {

        int len = buffer.getInt();
        if (len > 0)
        {
            return buffer.getString(len, DECODER_CHARSET);
        }
        return "";

    }
    
    public boolean getBoolean(IoBuffer buffer)
    {
        byte trueValue=(byte)1;
        return buffer.get()==trueValue?true:false;
    }
}
